<template>
  <div class="header-banner">
    <div class="header-banner-left">
      <img src="@/assets/images/system/logo.png" alt="" />
      <span>校园共享单车管理系统</span>
    </div>
    <div class="header-banner-right">
      <el-dropdown @command="handleCommand">
        <el-avatar
          src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
        ></el-avatar>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item command="mine">个人信息</el-dropdown-item>
          <el-dropdown-item command="exit">退出登录</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
      <span>admin</span>
    </div>
  </div>
</template>

<script>
export default {
  name: "HeaderBanner",
  data() {
    return {};
  },
  methods: {
    handleCommand(command) {
      if (command === "mine") {
        // TODO: 跳转到个人中心
      }
      if (command === "exit") {
        sessionStorage.removeItem("bike_token");
        this.$router.push({
          path: "/login",
        });
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.header-banner {
  width: 100%;
  height: 60px;
  box-sizing: border-box;
  padding: 0 40px;
  background: url("@/assets/images/system/banner.png") no-repeat;
  background-size: cover;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: default;
  .header-banner-left {
    display: flex;
    align-items: center;
    gap: 10px;
    img {
      width: 40px;
      height: 40px;
    }
    span {
      font-size: 22px;
      letter-spacing: 1px;
      color: #fff;
      font-weight: 700;
      vertical-align: middle;
    }
  }
  .header-banner-right {
    display: flex;
    align-items: center;
    gap: 10px;
    span {
      color: #fff;
      font-weight: 700;
    }
  }
}
</style>
